import 'package:yurun_smartmerchants/models/tobetally_response_entity.dart';

tobetallyResponseResponseFromJson(TobetallyResponseResponse data, Map<String, dynamic> json) {
	if (json['number'] != null) {
		data.number = json['number']?.toInt();
	}
	if (json['last'] != null) {
		data.last = json['last'];
	}
	if (json['numberOfElements'] != null) {
		data.numberOfElements = json['numberOfElements']?.toInt();
	}
	if (json['size'] != null) {
		data.size = json['size']?.toInt();
	}
	if (json['totalPages'] != null) {
		data.totalPages = json['totalPages']?.toInt();
	}
	if (json['pageable'] != null) {
		data.pageable = new TobetallyResponseResponsePageable().fromJson(json['pageable']);
	}
	if (json['sort'] != null) {
		data.sort = new TobetallyResponseResponseSort().fromJson(json['sort']);
	}
	if (json['content'] != null) {
		data.content = new List<TobetallyResponseResponseContent>();
		(json['content'] as List).forEach((v) {
			data.content.add(new TobetallyResponseResponseContent().fromJson(v));
		});
	}
	if (json['first'] != null) {
		data.first = json['first'];
	}
	if (json['totalElements'] != null) {
		data.totalElements = json['totalElements']?.toInt();
	}
	return data;
}

Map<String, dynamic> tobetallyResponseResponseToJson(TobetallyResponseResponse entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['number'] = entity.number;
	data['last'] = entity.last;
	data['numberOfElements'] = entity.numberOfElements;
	data['size'] = entity.size;
	data['totalPages'] = entity.totalPages;
	if (entity.pageable != null) {
		data['pageable'] = entity.pageable.toJson();
	}
	if (entity.sort != null) {
		data['sort'] = entity.sort.toJson();
	}
	if (entity.content != null) {
		data['content'] =  entity.content.map((v) => v.toJson()).toList();
	}
	data['first'] = entity.first;
	data['totalElements'] = entity.totalElements;
	return data;
}

tobetallyResponseResponsePageableFromJson(TobetallyResponseResponsePageable data, Map<String, dynamic> json) {
	if (json['paged'] != null) {
		data.paged = json['paged'];
	}
	if (json['pageNumber'] != null) {
		data.pageNumber = json['pageNumber']?.toInt();
	}
	if (json['offset'] != null) {
		data.offset = json['offset']?.toInt();
	}
	if (json['pageSize'] != null) {
		data.pageSize = json['pageSize']?.toInt();
	}
	if (json['unpaged'] != null) {
		data.unpaged = json['unpaged'];
	}
	if (json['sort'] != null) {
		data.sort = new TobetallyResponseResponsePageableSort().fromJson(json['sort']);
	}
	return data;
}

Map<String, dynamic> tobetallyResponseResponsePageableToJson(TobetallyResponseResponsePageable entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['paged'] = entity.paged;
	data['pageNumber'] = entity.pageNumber;
	data['offset'] = entity.offset;
	data['pageSize'] = entity.pageSize;
	data['unpaged'] = entity.unpaged;
	if (entity.sort != null) {
		data['sort'] = entity.sort.toJson();
	}
	return data;
}

tobetallyResponseResponsePageableSortFromJson(TobetallyResponseResponsePageableSort data, Map<String, dynamic> json) {
	if (json['unsorted'] != null) {
		data.unsorted = json['unsorted'];
	}
	if (json['sorted'] != null) {
		data.sorted = json['sorted'];
	}
	return data;
}

Map<String, dynamic> tobetallyResponseResponsePageableSortToJson(TobetallyResponseResponsePageableSort entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['unsorted'] = entity.unsorted;
	data['sorted'] = entity.sorted;
	return data;
}

tobetallyResponseResponseSortFromJson(TobetallyResponseResponseSort data, Map<String, dynamic> json) {
	if (json['unsorted'] != null) {
		data.unsorted = json['unsorted'];
	}
	if (json['sorted'] != null) {
		data.sorted = json['sorted'];
	}
	return data;
}

Map<String, dynamic> tobetallyResponseResponseSortToJson(TobetallyResponseResponseSort entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['unsorted'] = entity.unsorted;
	data['sorted'] = entity.sorted;
	return data;
}

tobetallyResponseResponseContentFromJson(TobetallyResponseResponseContent data, Map<String, dynamic> json) {
	if (json['modifiedTime'] != null) {
		data.modifiedTime = json['modifiedTime']?.toString();
	}
	if (json['batchNo'] != null) {
		data.batchNo = json['batchNo']?.toString();
	}
	if (json['postWeight'] != null) {
		data.postWeight = json['postWeight']?.toDouble();
	}
	if (json['consumerId'] != null) {
		data.consumerId = json['consumerId']?.toInt();
	}
	if (json['creatorId'] != null) {
		data.creatorId = json['creatorId']?.toInt();
	}
	if (json['modifierId'] != null) {
		data.modifierId = json['modifierId']?.toInt();
	}
	if (json['categoryName'] != null) {
		data.categoryName = json['categoryName']?.toString();
	}
	if (json['marketId'] != null) {
		data.marketId = json['marketId']?.toInt();
	}
	if (json['createdTime'] != null) {
		data.createdTime = json['createdTime']?.toString();
	}
	if (json['categoryUrl'] != null) {
		data.categoryUrl = json['categoryUrl']?.toString();
	}
	if (json['preWeight'] != null) {
		data.preWeight = json['preWeight']?.toDouble();
	}
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['categoryId'] != null) {
		data.categoryId = json['categoryId']?.toInt();
	}
	if (json['status'] != null) {
		data.status = json['status']?.toInt();
	}
	return data;
}

Map<String, dynamic> tobetallyResponseResponseContentToJson(TobetallyResponseResponseContent entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['modifiedTime'] = entity.modifiedTime;
	data['batchNo'] = entity.batchNo;
	data['postWeight'] = entity.postWeight;
	data['consumerId'] = entity.consumerId;
	data['creatorId'] = entity.creatorId;
	data['modifierId'] = entity.modifierId;
	data['categoryName'] = entity.categoryName;
	data['marketId'] = entity.marketId;
	data['createdTime'] = entity.createdTime;
	data['categoryUrl'] = entity.categoryUrl;
	data['preWeight'] = entity.preWeight;
	data['id'] = entity.id;
	data['categoryId'] = entity.categoryId;
	data['status'] = entity.status;
	return data;
}